/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.webos.java.sessinfo;

import org.webos.java.base.*;
import org.webos.java.root.Log;

/**
 *
 * @author kostya
 */

@DialogType(jsClass="sessinfo.NewMessageDialog")
public class NewMessageDialog extends Dialog{

    public NewMessageDialog(SessionsInfo application, Message message) {
        super(application);
        try {
            getData().put("from", message.from);
            getData().put("message", message.message);
            getData().put("receiveDate", application.sessionList.dateFormat.format(
                    getApplication().getSession().normalizeDate(message.receiveDate)));
            application.getSession().addDialog(this);
            application.chatHistory.sendMessage("addMessage", getData());
        } catch (Throwable t) {
            Log.error(this, "Exception thrown: " + t.getMessage());
            t.printStackTrace();
        }

    }

}
